import {
<#list packages as p>
    ${p}<#sep>,</#sep>
</#list>
} from "./msg"

export default class MsgManager{
    private id2Msg:${"Map<number,any>"} = new Map();
    private msg2Id:${"Map<any,number>"} = new Map();



    private static  _instance = new MsgManager()
    private constructor(){
        this.registerMsg()
    }

    public static get instance(){
        return MsgManager._instance
    }
    registerMsg() {
<#list msgDefinitions as def>
        this.id2Msg.set(${def.msgId?c},${def.package_name}.${def.name})
        this.msg2Id.set(${def.package_name}.${def.name},${def.msgId?c})
</#list>

    }

    getMsg(msgId:number){
        return this.id2Msg.get(msgId)
    }
    getMsgId(msgType:any){
        return this.msg2Id.get(msgType)
    }
}
